<template>
  <div id="teamPage" style="padding-top: 20px">
<!--    <van-search v-model="searchText" placeholder="请输入搜索队伍关键词" @search="onSearch" />-->
    <van-button type="success" @click="doJoinTeam()">创建队伍</van-button>
    <van-empty v-if="!teamList || teamList.length < 1" description="您还没有队伍"/>
  </div>
  <TeamCardList :teamList="teamList"/>

</template>
<script setup>
import {onMounted, ref} from "vue";
import TeamCardList from "../components/TeamCardList.vue";
import {useRouter} from "vue-router";
import myAxios from "../plugins/myAxios.ts";

name:'Team'



const teamList = ref([])
const router = useRouter();
const doJoinTeam = () => {
  router.push({
    path: "/team/add"
  })
}
const listTeam = async () => {
  const res = await myAxios.get('/team/myTeam', {
    params: {
      pageNum: 1
    }
  })
  if (res.code === 0) {
    teamList.value = res.data
  } else {
    console.log('error')
  }
}
onMounted(() => {
  listTeam()
  console.log(teamList)
})


</script>
<style scoped>

</style>